Refactor test suite: layered unit/doctree/integration with shared fixtures#21
Conversation
Consolidate duplicated _build_sphinx helpers, wheel constants, and conf templates into tests/support.py. Add shared assertion helpers and pytest fixtures without changing test behavior (41 tests still pass). Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Move unit tests into tests/unit/ with parametrized cases. Replace the html_builder fixture in asset_href tests with mock_html_builder for faster isolated checks. Extract _autodoc_packages tests into test_config.py. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Move autodoc scope and py-repl directive tests into tests/doctree/ using sphinx-pytest instead of full HTML builds. Remove redundant tests covered by unit tests (replay body, multiline terminator, package doctree checks). Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Reorganize full-build tests into tests/integration/, remove redundant top-level integration files, and add targeted tests for directive flags, missing src errors, copy_asset_files edge cases, vendored JS copy, and startup file deduplication. Suite is now 47 tests with 100% coverage. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
|
@cursoragent review |
PR Review: Refactor test suite (#21)Verdict: Approve with minor nits. This PR delivers on its goal — a clearer testing pyramid, less duplication, and better coverage — without touching production code. The structure is a meaningful improvement over the flat 10-file layout. What works wellClear layering. The split into Shared infrastructure is the right abstraction. Consolidating Parametrization is used well. Redundancy cuts are justified. Removing Gap-filling tests are targeted. The new tests for CI compatibility. Issues to address (minor)1. Unused
|
| Claim | Verified |
|---|---|
| 41 → 47 tests | Yes |
| ~5.4s → ~4.0s | Yes (~3.99s locally) |
| 97% → 100% coverage | Yes |
5 → 1 _build_sphinx |
Yes |
| No production code changes | Yes |
| 6 integration tests | No — there are 10 |
Recommendation
Merge after:
- Removing the unused
wheel_pathsfixture (optional but tidy). - Fixing the integration test count in the PR description.
No blocking issues. The refactor is a solid foundation for future extension work — new behaviors should land in unit/doctree first, with integration reserved for wiring and file output.
Documentation build overview
|
…d fixture - Make tests/ a proper package with tests.* imports - Move sys.path setup into conftest.py only - Remove unused wheel_paths fixture - Strengthen non-HTML copy_asset_files test to assert no output files Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
3251ca0
into
cursor/autodoc-bootstrap-src-only-16b5


Summary
Aggressive refactor of the test suite to eliminate redundant coverage, introduce a clear testing pyramid, and improve maintainability. No production code changes.
Before / After
sphinx_pyrepl_webcoverage_build_sphinxcopiessupport.py)New structure
Key changes
_asset_href,doctest_to_replay_source,autodoc_bootstrap_source, and_autodoc_packages. Replaced full Sphinx builds in asset_href tests withmock_html_builder.sphinx-pytest(~10× faster for those cases).include::routing.:src:errors, directive flags (:no-buttons:,:readonly:,:silent:,:repl-title:), non-HTMLcopy_asset_files, empty replay metadata, vendored JS copy, startup file deduplication, and empty doctest transform skip.Test plan
PYTHONWARNINGS=error pytest --cov --durations=10 .— 47 passed, 100% coverage onsphinx_pyrepl_web/__init__.py